<%@ page import="com.party.core.model.system.TargetType" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<%@ taglib prefix="memberForm" uri="http://www.tongxingzhe.cn/memberForm" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>${event == null ? '发布' : '编辑'}主题</title>
    <%@include file="../include/commonFile.jsp" %>
    <script src="//api.map.baidu.com/api?v=2.0&ak=2izIwlMmDVH737ms8m4Y8uHsoxtEIR65"></script>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/ui/activity/publish_form.css">
    <link rel="stylesheet" href="${ctx}/static/uploadCI/upload.css">
    <style TYPE="text/css">
        .img-item1 {
            position: relative;
            width: 155px !important;
            height: 220px !important;
            border: 5px solid #e6e6e6;
            margin-bottom: 0px;
            background-repeat: no-repeat;
            background-position: center;
            background-size: cover;
            cursor: pointer;
            float: none;
        }
    </style>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <!-- 正文请写在这里 -->
            <div class="add-form-content">
                <form id="myForm" class="layui-form mt20" method="post" action="${ctx}/crowdfund/event/save.do">
                    <div class="preview-box">
                        <div class="top-tip">
                            <span class="tip-inner"><span class="tip-title">效果预览</span></span>
                        </div>
                        <a class="preview-btn layui-btn layui-btn-danger layui-btn-sm" href="javascript:void(0)"
                           lay-submit
                           lay-filter="*"><i class="iconfont icon-refresh btn-icon"></i>预览</a>
                        <iframe style="width: 360px;height: 760px;"
                                src="${ctx}/phone/preview.do?url=/micWeb/html/project/theme_preview.html?id=${event.id}"
                                frameborder="0"></iframe>
                    </div>
                    <div class="form-outer">

                        <input type="hidden" name="id" value="${event.id}"/>
                        <input type="hidden" name="checkStatus" value="${event.checkStatus}"/>
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属合作商<span class="f-verify-red">*</span></label>
                            <div class="layui-input-inline">
                                <input type="hidden" id="memberId" name="createBy" lay-verify="orgId"
                                       value="${event.createBy}"/>
                                <input type="text" id="memberName" value="${memberForm:getRealNameById(event.createBy)}"
                                       class="layui-input" readonly/>
                            </div>
                            <c:if test="${empty event.id}">
                                <a class="layui-btn layui-btn-danger" type="button"
                                   onclick="openSelMemberDialog(this,'选择所属合作商','${ctx}/system/member/selectPartner.do','950px','570px')">选择
                                </a>
                            </c:if>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">主题名称<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <input type="text" maxlength="50" name="name" lay-verify="name" autocomplete="off"
                                       class="layui-input margin-right" value="${event.name}"
                                       style="width: 50%; ">
                                <div class="layui-form-mid layui-word-aux">主题名称，最多50字符</div>
                                <div class="cl"></div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">活动海报<span class="f-verify-red">*</span></label>
                            <div class="cover-content">
                                <input type="hidden" name="pic" id="pic" lay-verify="pic" value="${event.pic}"/>
                                <c:if test="${event == null || empty event.pic}">
                                <span id="cover-img" class="cover-img"
                                      style="background-image:url(${ctx}/image/posterImg.png)"></span>
                                </c:if>
                                <c:if test="${event != null && not empty event.pic}">
                                <span id="cover-img" class="cover-img"
                                      style="background-image:url('${event.pic}')"></span>
                                </c:if>
                                <c:if test="${not empty event.id}">
                                    <a class="layui-btn layui-btn-danger" id="sel_pic_img">更换海报</a>
                                </c:if>
                                <c:if test="${empty event.id}">
                                    <a class="layui-btn layui-btn-danger" id="sel_pic_img">添加海报</a>
                                </c:if>
                                <div class="form-word-aux">建议尺寸：800x450</div>
                            </div>
                        </div>
                        <div class="split-line"></div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">报名截止时间<span class="f-verify-red">*</span></label>
                                <div class="layui-input-inline">
                                    <input class="layui-input" name="endDate" lay-verify="endDate" placeholder="报名截止时间"
                                           id="endTime" readonly
                                           value='<fmt:formatDate value="${event.endTime}" pattern="yyyy-MM-dd HH:mm" />'/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">请选择报名截止时间</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">活动开始时间<span class="f-verify-red">*</span></label>
                                <div class="layui-input-inline">
                                    <input class="layui-input" name="startDate" lay-verify="startDate"
                                           placeholder="活动开始时间"
                                           id="startTime" readonly
                                           value='<fmt:formatDate value="${event.startTime}" pattern="yyyy-MM-dd HH:mm" />'/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">活动开始时间不能早于报名截止时间</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">报名信息<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <%@include file="../include/projectInfo.jsp" %>
                            </div>
                        </div>
                        <%--<div class="layui-form-item">--%>
                            <%--<div class="layui-inline">--%>
                                <%--<label class="layui-form-label">人数上限<span class="f-verify-red">*</span></label>--%>
                                <%--<div class="layui-input-inline">--%>
                                    <%--<input type="number" min="1" name="limitNum" lay-verify="limitNum"--%>
                                           <%--autocomplete="off"--%>
                                           <%--placeholder="请输入报名人数上限" class="layui-input" value="${event.limitNum}">--%>
                                <%--</div>--%>
                                <%--<div class="layui-form-mid layui-word-aux">仅可输入数字</div>--%>
                            <%--</div>--%>
                        <%--</div>--%>
                        <%--<div class="layui-form-item">--%>
                            <%--<div class="layui-inline">--%>
                                <%--<label class="layui-form-label">活动金额<span class="f-verify-red">*</span></label>--%>
                                <%--<div class="layui-input-inline">--%>
                                    <%--<input type="text" name="price" lay-verify="price" placeholder="请输入活动金额"--%>
                                           <%--class="layui-input" ${eventActivity.joinNum > 0 and isCopy == null ? 'readonly' : ''}--%>
                                           <%--<c:if test="${not empty event.price}">value="<fmt:formatNumber value="${event.price}" pattern="0.00"/>"--%>
                                    <%--</c:if>--%>
                                    <%--/>--%>
                                <%--</div>--%>
                                <%--<div class="layui-form-mid layui-word-aux">仅可输入数字</div>--%>
                            <%--</div>--%>
                        <%--</div>--%>
                        <input type="hidden" name="price" readonly />
                        <div class="layui-form-item">
                            <label class="layui-form-label">单次支付金额<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <input type="radio" name="switchSupportRange" value="1" lay-filter="switchSupportRange"
                                       title="默认金额" ${empty event.id || event.switchSupportRange == 1 ? 'checked="checked"' : ''}>
                                <input type="radio" name="switchSupportRange" value="2" lay-filter="switchSupportRange"
                                       title="固定金额" ${not empty event.id && event.switchSupportRange == 2 ? 'checked="checked"' : ''}>
                                <input type="radio" name="switchSupportRange" value="3" lay-filter="switchSupportRange"
                                       title="自定义金额" ${not empty event.id && event.switchSupportRange == 3 ? 'checked="checked"' : ''}>
                            </div>
                        </div>
                        <div class="range-fixed layui-form-item" ${event.switchSupportRange == 2 ? '' : 'style="display:none"'}>
                            <div class="layui-inline">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input type="text" name="supportRange" lay-verify="supportRange" class="layui-input"
                                           value="${event.supportRange}"/>
                                </div>
                            </div>
                        </div>
                        <div class="range-custom layui-form-item" ${event.switchSupportRange == 3 ? '' : 'style="display:none"'}>
                            <div class="layui-inline">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input type="text" name="rangeStart" lay-verify="rangeStart" class="layui-input"
                                           value="${event.rangeStart}"/>
                                </div>
                                <div class="layui-input-inline" style="width: 10px; margin-top: 8px; margin-left: 2px;">
                                    -
                                </div>
                                <div class="layui-input-inline">
                                    <input type="text" name="rangeEnd" lay-verify="rangeEnd" class="layui-input"
                                           value="${event.rangeEnd}"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">只能输入整数</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">众筹攻略<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <input type="radio" name="strategyState" value="0"
                                       title="显示" ${event == null || event.strategyState == 0 ? 'checked="checked"' : ''}>
                                <input type="radio" name="strategyState" value="1"
                                       title="不显示" ${event != null && event.strategyState == 1 ? 'checked="checked"' : ''}>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">常见问题<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <input type="radio" name="isProblem" value="1"
                                       title="显示" ${event == null || event.isProblem == 1 ? 'checked="checked"' : ''}>
                                <input type="radio" name="isProblem" value="0"
                                       title="不显示" ${event != null && event.isProblem == 0 ? 'checked="checked"' : ''}>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">播放背景乐<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <input type="radio" name="isPlayMusic" lay-filter="isPlayMusic" value="0"
                                       title="否" ${event == null || event.isPlayMusic == 0 ? 'checked="checked"' : ''}>
                                <input type="radio" name="isPlayMusic" lay-filter="isPlayMusic" value="1"
                                       title="是" ${event != null && event.isPlayMusic == 1 ? 'checked="checked"' : ''}>
                            </div>
                        </div>
                        <div class="layui-form-item"
                             id="audioDiv" ${event == null || event.isPlayMusic == 0 ? 'style="display:none"' : ''} >
                            <span class="layui-inline">
                                <label class="layui-form-label">背景乐<span class="f-verify-red">*</span></label>
                                <div class="layui-input-inline">
                                    <select name="audioId" id="audioId" lay-verify="audioId" lay-filter="audioId">
                                        <option value="" title="">请选择背景乐</option>
                                    </select>
                                </div>
                                <span id="audioUrlId" style="display: none;"><audio style="height: 40px;" src=""
                                                                                    controls="controls" preload></audio></span>
                        </span></div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">选择海报背景图<span class="f-verify-red">*</span></label>
                                <div class="layui-input-inline">
                                    <input type="radio" name="isCustomPoster" lay-filter="isCustomPoster" value="0"
                                           title="默认" ${event == null || event.isCustomPoster == 0 ? 'checked="checked"' : ''}>
                                    <input type="radio" name="isCustomPoster" lay-filter="isCustomPoster" value="1"
                                           title="自定义" ${event != null && event.isCustomPoster == 1 ? 'checked="checked"' : ''}>
                                </div>
                                <div class="layui-inline"
                                     id="customPosterDiv" ${event == null || event.isCustomPoster == 0 ? 'style="display:none"' : ''}>
                                    <div class="u-single-upload">
                                        <c:if test="${event != null && not empty event.networkImagePath}">
                                            <a class="layui-btn layui-btn-danger" id="sel_poster_img">更换背景图</a>
                                        </c:if>
                                        <c:if test="${event == null || empty event.networkImagePath}">
                                            <a class="layui-btn layui-btn-danger" id="sel_poster_img">添加背景图</a>
                                        </c:if>
                                    </div>
                                    <div class="form-word-aux">建议像素：750x1334，建议大小：小于等于200KB</div>
                                </div>

                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <div class="layui-input-inline">
                                    <input type="hidden" name="networkImagePath" id="networkImagePath"
                                           lay-verify="networkImagePath" value="${event.networkImagePath}"/>
                                    <c:if test="${event == null || empty event.networkImagePath}">
                                        <div id="zc-p-cover-img" class="img-item1"
                                             style="background-image: url(${ctx}/image/poster/19newYear_bz.png)">
                                        </div>
                                    </c:if>
                                    <c:if test="${event != null && not empty event.networkImagePath}">
                                        <div id="zc-p-cover-img" class="img-item1"
                                             style="background-image: url(${event.networkImagePath})">
                                        </div>
                                    </c:if>
                                </div>
                            </div>
                            <%--                            <div class="dib calc-350">
                                                            <a class="red tip-link"
                                                               href="javascript:doloadPoster()">
                                                                <i class="iconfont icon-piclight"></i>海报排板效果展示</a>
                                                            <p class="gray">说明:海报头像和二维码的位置不会改变，请务必按指定的像素和大小上传背景图</p>
                                                        </div>--%>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">消息提示<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <input type="radio" name="crowdfundHintSwitch" value="0"
                                       title="否" ${event == null || event.crowdfundHintSwitch == 0 ? 'checked="checked"' : ''}>
                                <input type="radio" name="crowdfundHintSwitch" value="1"
                                       title="是" ${event != null && event.crowdfundHintSwitch == 1 ? 'checked="checked"' : ''}>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">隐藏数据<span class="f-verify-red">*</span></label>
                                <div class="layui-input-inline">
                                    <input type="radio" name="templateStyle" value="0"
                                           title="否" ${event == null || event.templateStyle == 0 ? 'checked="checked"' : ''}>
                                    <input type="radio" name="templateStyle" value="1"
                                           title="是" ${event != null && event.templateStyle == 1 ? 'checked="checked"' : ''}>
                                </div>
                                <div class="dib calc-350" style="width: calc(100% - 330px);">
                                    <a class="red tip-link"
                                       href="javascript:openHiddenShow('手机效果展示图', '#hidden_show_plane')">
                                        <i class="iconfont icon-piclight"></i>效果展示图</a>
                                    <p class="gray">说明:在前期众筹数据较少时，适当使用隐藏数据功能，可以避免推广的尴尬，等数据较多时可再调整</p>
                                </div>
                            </div>
                        </div>

                        <%--<div class="layui-form-item" style="margin-bottom: 0px">--%>
                        <%--<div class="layui-inline">--%>
                        <%--<label class="layui-form-label">个人排行榜<span class="f-verify-red">*</span></label>--%>
                        <%--<div class="layui-input-inline" style="width: 300px">--%>
                        <%--<input type="radio" name="personalRanking" value="0" lay-filter="personalRanking"--%>
                        <%--title="默认显示全部" ${empty event.id || event.personalRanking == 0 ? 'checked="checked"' : ''}>--%>
                        <%--<input type="radio" name="personalRanking" value="1" lay-filter="personalRanking"--%>
                        <%--title="自定义显示人数" ${not empty event.id && event.personalRanking == 1 ? 'checked="checked"' : ''}>--%>
                        <%--<input type="radio" name="personalRanking" value="2" lay-filter="personalRanking"--%>
                        <%--title="不显示" ${not empty event.id && event.personalRanking == 2 ? 'checked="checked"' : ''}>--%>
                        <%--</div>--%>
                        <%--<div class="dib calc-350" style="width: calc(100% - 440px);" >--%>
                        <%--<a class="red tip-link"--%>
                        <%--href="javascript:openHiddenShow('手机效果展示图', '#hidden_show_plane')">--%>
                        <%--<i class="iconfont icon-piclight"></i>效果展示图</a>--%>
                        <%--<p class="gray">说明：排行榜显示该主题下的报名人员排名，可以设置显示的报名人数，最少10名，可以设置10的倍数</p>--%>
                        <%--</div>--%>
                        <%--</div>--%>
                        <%--</div>--%>
                        <div class="layui-form-item" style="margin-bottom: 10px;">
                            <div class="layui-inline" style="vertical-align: bottom;">
                                <label class="layui-form-label">个人排行榜<span class="f-verify-red">*</span></label>
                                <div class="layui-input-inline">
                                    <input type="radio" name="personalRanking" value="0" lay-filter="personalRanking"
                                           title="默认显示全部" ${empty event.id || event.personalRanking == 0 ? 'checked="checked"' : ''}>
                                    <input type="radio" name="personalRanking" value="1" lay-filter="personalRanking"
                                           title="自定义显示人数" ${not empty event.id && event.personalRanking == 1 ? 'checked="checked"' : ''}>
                                    <input type="radio" name="personalRanking" value="2" lay-filter="personalRanking"
                                           title="不显示" ${not empty event.id && event.personalRanking == 2 ? 'checked="checked"' : ''}>
                                </div>
                                <div class="dib calc-350" style="width: calc(100% - 440px);">
                                    <a class="red tip-link"
                                       href="javascript:openHiddenShow('手机效果展示图', '#hidden_show_plane2')">
                                        <i class="iconfont icon-piclight"></i>效果展示图</a>
                                    <p class="gray">说明：排行榜显示该主题下的报名人员排名，默认显示全部人数，可以设置10的倍数，
                                        最多不能超过人数上限，人数上限低于10的，默认显示全部人数，不可设置。</p>
                                </div>
                                <div class="range-personal" ${event.personalRanking == 1 ? '' : 'style="display:none"'}>
                                    <div class="layui-inline" style="margin-top: 4px;">
                                        <div class="layui-input-inline">
                                            <input type="text" name="peopleNum" lay-verify="peopleNum"
                                                   class="layui-input" value="${event.peopleNum}"/>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <%@include file="../activity/cityAreaMapNew.jsp" %>
                        <div class="split-line"></div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">众筹宣言<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                            <textarea maxlength="100" class="layui-textarea calc-110" name="crowdDeclaration"
                                      lay-verify="crowd_xy"
                                      placeholder="请输入众筹宣言，让大家来参与报名吧！">${event.crowdDeclaration}</textarea>
                                <div class="layui-form-mid layui-word-aux">最多100字符</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">支持宣言<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                            <textarea maxlength="100" class="layui-textarea calc-110" name="supportDeclaration"
                                      lay-verify="support_xy"
                                      placeholder="请输入支持宣言，让大家支持本次活动吧！">${event.supportDeclaration}</textarea>
                                <div class="layui-form-mid layui-word-aux">最多100字符</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">联合发起宣言<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                            <textarea maxlength="100" class="layui-textarea calc-110" name="representDeclaration"
                                      lay-verify="represent_xy"
                                      placeholder="请输入联合发起宣言，让大家来参与联合发起吧！">${event.representDeclaration}</textarea>
                                <div class="layui-form-mid layui-word-aux">最多100字符</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">活动描述</label>
                            <div class="layui-input-block">
                                <textarea maxlength="100" class="layui-textarea calc-110" name="remarks"
                                          placeholder="活动描述">${event.remarks}</textarea>
                                <div class="layui-form-mid layui-word-aux">最多100字符</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">轮播图</label>
                            <a href="javascript:openUploadCI()" class="layui-btn  layui-btn-danger">+添加图片</a>
                            <div class="layui-input-block" style="min-height: auto;">
                                <input type="hidden" name="picList" id="picList" lay-verify="picList"/>
                                <div class="zc-ci-img-list ci-img-list" id="img_list">
                                    <c:forEach var="resource" items="${picList}">
                                        <div class="item" data-url="${resource.resourceUrl}">
                                            <div class="img-item"
                                                 style="background-image: url('${resource.resourceUrl}')">
                                                <i class="layui-icon del-icon"
                                                   onclick="delQImg('${resource.resourceUrl}',this, '${resource.id}')">&#x1007;</i>
                                            </div>
                                        </div>
                                    </c:forEach>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">视频</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="videoList" id="videoList"/>
                                <div style="margin-bottom: 10px;">
                                <textarea class="layui-textarea video-link margin-right calc-110"
                                          readonly
                                          style="min-height: 80px;"
                                          id="vide_code">${video.resourceUrl}</textarea>
                                    <a href="javascript:openUploadVideo()" class="red" style="display: inline-block; margin-bottom: 5px">添加视频</a>
                                    <a href="javascript:clearValue()" class="red" style="display: inline-block">清除视频</a>
                                    <div class="cl"></div>
                                </div>
                                <input type="text" maxlength="30" placeholder="请输入视频简介"
                                       class="layui-input video-remarks margin-right"
                                       style="width: calc(90% - 190px);"
                                       value="${video.remarks}">
                                <div class="layui-form-mid layui-word-aux">最多30字符</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">活动详情<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <script id="ueditor1" type="text/plain"></script>
                                <div style="display: none" id="contentView">${activityDetail.content}</div>
                                <input type="hidden" name="content" id="content" lay-verify="content"
                                       data-link-ue="ueditor1"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">报名相关<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <script id="relatedUeditor" type="text/plain"></script>
                                <div style="display: none" id="applyRelatedView">${activityDetail.applyRelated}</div>
                                <input type="hidden" name="applyRelated" id="applyRelated" lay-verify="applyRelated"
                                       data-link-ue="relatedUeditor"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">参赛标准<span class="f-verify-red">*</span></label>
                            <div class="layui-input-block">
                                <script id="standardUeditor" type="text/plain"></script>
                                <div style="display: none" id="matchStandardView">${activityDetail.matchStandard}</div>
                                <input type="hidden" name="matchStandard" id="matchStandard" lay-verify="matchStandard"
                                       data-link-ue="standardUeditor"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <a href="javascript:void(0)" class="layui-btn layui-btn-danger" lay-submit
                                   lay-filter="*">立即提交</a>
                                <a href="${ctx}/crowdfund/event/list.do" class="layui-btn layui-btn-primary">取消</a>
                            </div>
                        </div>
                        <div>
                            <input type="hidden" name="costCache" />
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!--底部-->
        <%@include file="../include/footer.jsp" %>

        <div style="display: none" id="create_date_str">
            <fmt:formatDate value="${event.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
        </div>
        <c:if test="${not empty event.createBy}">
            <c:set var="expirationTime" value="${memberForm:getExpirationTimeById(event.createBy)}"/>
            <c:set var="expireTime" value="${memberForm:dateFormat(expirationTime, 'yyyy-MM-dd HH:mm:ss')}"/>
            <c:set var="isExpire" value="${memberForm:isExpire(event.createBy, null)}"/>
        </c:if>
    </section>
    <div id="hidden_show_plane" class="pt15" style="display: none;">
        <div class="dib l" style="width: 50%;">
            <div class="pt10 pb10" style="border-right: 1px solid #7f7f7f;">
                <div class="show-img"
                     style="background-image: url(../../image/activity/hidden_show_before.jpg);"></div>
            </div>
            <p class="mt10 f18 tc">（未隐藏数据前）</p>
        </div>
        <div class="dib l" style="width: 50%;">
            <div class="pt10 pb10">
                <div class="show-img"
                     style="background-image: url(../../image/activity/hidden_show_after.jpg);"></div>
            </div>
            <p class="mt10 f18 tc">（隐藏数据后）</p>
        </div>
    </div>

    <div id="hidden_show_plane2" class="pt15" style="display: none;">
        <div class="show-img"
             style="background-image: url(../../image/activity/personal_ranking.png); width: 92%!important; height: 844px!important;"></div>
    </div>
</div>

<script type="text/javascript" src="${ctxStatic}/UEditor/ueditor.config.js"></script>
<script type="text/javascript" src="${ctxStatic}/UEditor/ueditor.all.js"></script>
<script type="text/javascript" src="${ctxStatic}/UEditor/myplugin/uploadCI.js"></script>
<script type="text/javascript" src="${ctxStatic}/UEditor/myplugin/uploadVideo.js"></script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" src="${ctxStatic}/UEditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="${ctx}/script/common/form_cache.js"></script>
<script>
    var isExpire = '${isExpire}', expireTime = '${expireTime}';
    var reg = /^([0-9]|([1-9][0-9]{0,9}))$/;
    var ue = UE.getEditor('ueditor1', {
        initialFrameWidth: 700,
        initialFrameHeight: 500

    });
    var relatedUeditor = UE.getEditor('relatedUeditor', {
        initialFrameWidth: 700,
        initialFrameHeight: 500
    });
    var standardUeditor = UE.getEditor('standardUeditor', {
        initialFrameWidth: 700,
        initialFrameHeight: 500
    });

    var form, laydate, formcache, switchSupport = '${event.switchSupportRange}' || 1, maxNum = 5;
    var personalRanking = '${event.personalRanking}';
    var endLaydate = {};
    var isPlayMusicVal = '${event.isPlayMusic}';
    var audioId_val = '${event.audioId}';
    var isCustomPoster_val = '${event.isCustomPoster}';
    var networkImagePath_val = '${event.networkImagePath}';
    function verify(value, title) {
        if (value == "") {
            return "请填写" + title;
        }
    }

    txz.initHeader({
        nav: [{
            name: '众筹主题',
            href: '${ctx}/crowdfund/event/list.do'
        }, {
            name: '${event == null ? '发布' : '编辑'}主题',
            curr: true
        }],
        info: '',
        btns: [{
            type: 'back'
        }]
    });

    $(function () {
        layui.use(['form', 'laydate'], function () {

            form = layui.form, laydate = layui.laydate;

            loadAudioSelect(audioId_val);

            //自定义验证规则
            form.verify({
                orgId: function (value) {
                    if (!value) {
                        return "请选择所属合作商"
                    }
                    if (isExpire == 'true' || isExpire == true) {
                        return "当前合作商已到期，不能发布数据"
                    }
                },
                name: function (value, ele) {
                    return verify(value, "主题名称");
                },
                crowd_xy: function (value) {
                    return verify(value, "众筹宣言");
                },
                support_xy: function (value) {
                    return verify(value, "支持宣言");
                },
                represent_xy: function (value) {
                    return verify(value, "联合发起宣言");
                },
                pic: function (value) {
                    if (value == "") {
                        return "请上传活动海报";
                    }
                },
                endDate: function (value) {
                    if (value == "") {
                        return "请选择报名截止时间";
                    }

                    if (util.getTimeMillis(value) < util.getTimeMillis()) {
                        return "报名截止时间不得早于当前时间";
                    }

                    if (expireTime) {
                        if (value >= expireTime) {
                            return "截止时间不能超过账户过期时间";
                        }
                    }
                },
                startDate: function (value) {
                    if (value == "") {
                        return "请选择活动开始时间";
                    }

                    if (util.getTimeMillis(value) < util.getTimeMillis()) {
                        return "活动开始时间不得早于当前时间";
                    }

                    var endDate = $("[name=endDate]").val();
                    if (value <= endDate) {
                        return "活动开始时间不能早于报名截止时间";
                    }
                },
                place: function (value) {
                    if (value == "") {
                        return "请输入活动场所";
                    }
                },
                area_select: function (value) {
                    var display = $("#areaInput").css("display");
                    if (value == "" && display == "none") {
                        return "请选择活动区域";
                    }
                },
                area_input: function (value) {
                    var display = $("#areaInput").css("display");
                    if (value == "" && display == "block") {
                        return "请输入活动区域";
                    }
                },
                city: function (value) {
                    if (value == "") {
                        return "请选择活动举办的城市";
                    }
                },
                // limitNum: function (value) {
                //     if (value == "") {
                //         return "请输入活动人数上限";
                //     } else if (!util.checkNumber(value)) {
                //         return "请输入正确的数字";
                //     } else if (parseInt(value) == 0) {
                //         return "请输入大于0的数字";
                //     }
                // },
                // price: function (value) {
                //     if (value == "") {
                //         return "请输入活动报名金额";
                //     } else if (!util.checkFloat(value)) {
                //         return "请输入正确的金额";
                //     } else if (parseFloat(value) == 0) {
                //         return "请输入大于0的金额";
                //     }
                // },
                // 固定金额
                supportRange: function (value) {
                    if (switchSupport == 2) {
                        var activityPrice = $("input[name=price]").val();
                        if (value == "") {
                            return "请输入金额";
                        } else if (!util.checkFloat(value)) {
                            return "请输入正确的金额";
                        } else if (parseFloat(value) == 0) {
                            return "请输入大于0的金额";
                        } else if (parseFloat(value) > parseFloat(activityPrice)) {
                            return "金额范围上限不得高于活动金额";
                        }
                    }
                },

                // 自定义人数
                peopleNum: function (value) {
                    if (personalRanking == 1) {
                        var activitylimitNum = $("input[name=limitNum]").val();
                        if (parseFloat(activitylimitNum) < 10) {
                            return "由于活动人数小于10人，所有不能自定义人数";
                        } else if (value == "") {
                            return "请输入自定义人数";
                        } else if (!util.checkFloat(value)) {
                            return "请输入正确的人数";
                        } else if (parseFloat(value) < 10) {
                            return "请输入大于10的人数";
                        } else if (parseFloat(value) > parseFloat(activitylimitNum)) {
                            return "请输入不得高于活动人数上限的数字";
                        }
                    }
                },

                // 自定义金额-上限
                rangeStart:

                    function (value, ele) {
                        if (switchSupport == 3) {
                            var _payPriceArray = getPrice();
                            if (_payPriceArray.length == 0) {
                                return
                            }
                            var activityPrice = Math.min.apply(null, _payPriceArray);
                            if (value == "") {
                                return "请输入金额";
                            } else if (!reg.test(value)) {
                                return "请输入正确的金额";
                            } else if (parseInt(value) > parseFloat(activityPrice)) {
                                return "金额范围上限不得高于活动金额";
                            } else {
                                var rangeStart = parseInt(value);
                                if (rangeStart < 50) {
                                    return "金额不得低于50";
                                } else {
                                    var residue = rangeStart % 100;
                                    if (residue != 0) {
                                        var flag = true;
                                        if (residue > 50) {
                                            flag = false;
                                            rangeStart = (rangeStart - residue) + 100;
                                        } else if (residue < 50) {
                                            flag = false;
                                            rangeStart = rangeStart - residue;
                                        }
                                        if (flag == false) {
                                            $(ele).val(rangeStart);
                                            return "请输入50或50的倍数";
                                        }
                                    }
                                }
                            }
                        }
                    }

                ,
                // 自定义金额-下限
                rangeEnd: function (value, ele) {
                    if (switchSupport == 3) {
                        var _payPriceArray = getPrice();
                        if (_payPriceArray.length == 0) {
                            return
                        }
                        var activityPrice = Math.max.apply(null, _payPriceArray);
                        if (value == "") {
                            return "请输入金额";
                        } else if (!reg.test(value)) {
                            return "请输入正确的金额";
                        } else if (parseInt(value) > parseFloat(activityPrice)) {
                            return "金额范围下限不得高于活动金额";
                        } else {
                            var rangeStart = parseInt($("[name=rangeStart]").val());
                            var rangeEnd = parseInt(value);
                            if (rangeEnd <= rangeStart) {
                                return "金额范围下限不得低于上限";
                            } else {
                                var residue = rangeEnd % 100;
                                if (residue != 0) {
                                    var flag = true;
                                    if (residue > 50) {
                                        flag = false;
                                        rangeEnd = (rangeEnd - residue) + 100;
                                    } else if (residue < 50) {
                                        flag = false;
                                        rangeEnd = rangeEnd - residue;
                                    }
                                    if (flag == false) {
                                        $(ele).val(rangeEnd);
                                        return "请输入50或50的倍数";
                                    }
                                }
                            }
                        }
                    }
                },
                // 背景乐
                audioId: function (value) {
                    if (isPlayMusicVal == 1) {
                        if (value == "") {
                            return "请选择背景乐";
                        }
                    }
                },
                // 海报背景图
                networkImagePath: function (value) {
                    if (isCustomPoster_val == 1) {
                        if (value == "" || value=="${ctx}/image/posterImg.png") {
                            return "请选择海报背景图";
                        }
                    }
                },
                content: function (value) {
                    $("#contentView").html(ue.getContent());
                    var content = $("#contentView").html();
                    if (content == "") {
                        return "请填写活动详情";
                    }
                }
                ,
                matchStandard: function (value) {
                    $("#matchStandardView").html(standardUeditor.getContent());
                    var content = $("#matchStandardView").html();
                    if (content == "") {
                        return "请填写参赛标准";
                    }
                }
                ,
                applyRelated: function (value) {
                    $("#applyRelatedView").html(relatedUeditor.getContent());
                    var content = $("#applyRelatedView").html();
                    if (content == "") {
                        return "请填写报名相关";
                    }
                }
                ,
                picList: function () {
                    var length = $("#img_list .img-item").length;
                    if (length > 5) {
                        return "最多只允许上传5张图片";
                    }
                }
            });

            form.on('radio(personalRanking)', function (data) {
                personalRanking = data.value;
                if (personalRanking == 1) {
                    $(".range-personal").show();
                } else if (personalRanking == 0) {
                    $(".range-personal").hide();
                } else if (personalRanking == 2) {
                    $(".range-personal").hide();
                }
            });

            form.on('radio(switchSupportRange)', function (data) {
                switchSupport = data.value;
                if (switchSupport == 1) {
                    $(".range-fixed").hide();
                    $(".range-custom").hide();
                } else if (switchSupport == 2) {
                    $(".range-fixed").show();
                    $(".range-custom").hide();
                } else if (switchSupport == 3) {
                    $(".range-fixed").hide();
                    $(".range-custom").show();
                }
            });

            form.on('select(audioId)', function (data) {
                var audioUrl_opction_val = data.elem[data.elem.selectedIndex].title
                isShowAudiolabel(audioUrl_opction_val)
            });
            //背景乐
            form.on('radio(isPlayMusic)', function (data) {
                isPlayMusicVal = data.value;
                if (isPlayMusicVal == 0) {
                    $("[name=audioId]").val("");
                    isShowAudiolabel("");
                    $("#audioDiv").hide();
                } else {
                    $("#audioDiv").show();
                }
                form.render('select');
            });

            //海报背景
            form.on('radio(isCustomPoster)', function (data) {
                isCustomPoster_val = data.value;
                if (isCustomPoster_val == 0) {
                    $('#zc-p-cover-img').css('background-image', 'url(' + "${ctx}/image/poster/19newYear_bz.png" + ')');
                    networkImagePath_val =  $('#networkImagePath').val();
                    $('#networkImagePath').val("");
                    $("#customPosterDiv").hide();
                } else {
                    if(networkImagePath_val==''){
                        networkImagePath_val="${ctx}/image/posterImg.png";
                    }
                    if($('#networkImagePath').val()==''){
                        $('#networkImagePath').val(networkImagePath_val);
                    }
                    $('#zc-p-cover-img').css('background-image', 'url(' + networkImagePath_val + ')');
                    $("#customPosterDiv").show();
                }
                form.render();
            });

            // 自定义人数
            $("[name=peopleNum]").blur(function () {
                if (personalRanking == 1) {
                    var value = $(this).val();
                    var activitylimitNum = $("input[name=limitNum]").val();
                    if (parseFloat(activitylimitNum) < 10) {
                        util.layerMsgError("由于活动人数小于10人，所有不能自定义人数");
                    } else if (value == "") {
                        util.layerMsgError("请输入自定义人数");
                    } else if (!util.checkFloat(value)) {
                        util.layerMsgError("请输入正确的人数")
                    } else if (parseFloat(value) == 0) {
                        util.layerMsgError("请输入大于0的人数")
                    } else if (parseFloat(value) > parseFloat(activitylimitNum)) {
                        util.layerMsgError("请输入不得高于活动人数上限的数字")
                    }
                }
            });

            // 固定金额
            $("[name=supportRange]").blur(function () {
                if (switchSupport == 2) {
                    var value = $(this).val();
                    var activityPrice = $("input[name=price]").val();
                    if (value == "") {
                        util.layerMsgError("请输入金额")
                    } else if (!util.checkFloat(value)) {
                        util.layerMsgError("请输入正确的金额")
                    } else if (parseFloat(value) == 0) {
                        util.layerMsgError("请输入大于0的金额")
                    } else if (parseFloat(value) > parseFloat(activityPrice)) {
                        util.layerMsgError("请输入不得高于活动金额的数字")
                    }
                }
            });
            // 自定义金额-上限
            $("[name=rangeStart]").blur(function () {
                if (switchSupport == 3) {
                    var _payPriceArray = getPrice();
                    if (_payPriceArray.length == 0) {
                        return
                    }
                    var activityPrice = Math.min.apply(null, _payPriceArray);
                    var value = $(this).val();
                    if (value == "") {
                        util.layerMsgError("请输入金额")
                    } else if (!reg.test(value)) {
                        util.layerMsgError("请输入正确的金额")
                    } else if (parseInt(value) > parseFloat(activityPrice)) {
                        util.layerMsgError("请输入不得高于活动金额的数字")
                    } else {
                        var rangeStart = parseInt(value);
                        if (rangeStart < 50) {
                            util.layerMsgError('金额不得低于50');
                        } else {
                            var residue = rangeStart % 100;
                            if (residue != 0) {
                                var flag = true;
                                if (residue > 50) {
                                    flag = false;
                                    rangeStart = (rangeStart - residue) + 100;
                                } else if (residue < 50) {
                                    flag = false;
                                    rangeStart = rangeStart - residue;
                                }
                                if (flag == false) {
                                    util.layerMsgError("请输入50或50的倍数", function () {
                                        $("[name=rangeStart]").val(rangeStart);
                                    });
                                }
                            }
                        }
                    }
                }
            });
            // 自定义金额-下限
            $("[name=rangeEnd]").blur(function () {
                if (switchSupport == 3) {
                    var _payPriceArray = getPrice();
                    if (_payPriceArray.length == 0) {
                        return
                    }
                    var activityPrice = Math.max.apply(null, _payPriceArray);
                    var value = $(this).val();
                    if (value == "") {
                        util.layerMsgError("请输入金额")
                    } else if (!reg.test(value)) {
                        util.layerMsgError("请输入正确的金额")
                    } else if (parseInt(value) > parseFloat(activityPrice)) {
                        util.layerMsgError("请输入不得高于活动金额的数字")
                    } else {
                        var rangeEnd = parseInt(value);
                        var rangeStart = parseInt($("[name=rangeStart]").val());
                        if (rangeEnd <= rangeStart) {
                            util.layerMsgError('金额范围下限不得低于上限');
                        } else {
                            var residue = rangeEnd % 100;
                            if (residue != 0) {
                                var flag = true;
                                if (residue > 50) {
                                    flag = false;
                                    rangeEnd = (rangeEnd - residue) + 100;
                                } else if (residue < 50) {
                                    flag = false;
                                    rangeEnd = rangeEnd - residue;
                                }
                                if (flag == false) {
                                    util.layerMsgError("请输入50或50的倍数", function () {
                                        $("[name=rangeEnd]").val(rangeEnd);
                                    });
                                }
                            }
                        }
                    }
                }
            });

            //监听提交
            form.on('submit', function (data) {
                if (checkCost()) {
                    formSubmit(data);
                }
            });
            form.render('radio');

            var min;
            if (${empty event.id}) {
                min = new Date().Format('yyyy-MM-dd HH:mm:ss');
            } else {
                min = $("#create_date_str").text();
            }

            endLaydate = laydate.render({
                elem: '#endTime',
                min: min,
                max: expireTime || '2099-06-16 23:59',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm' //日期格式
            });


            //日期
            var start = {
                elem: '#startTime',
                min: min,
                max: '2099-06-16 23:59',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm'
            };

            laydate.render(start);

            //初始化地图控件
            txz.Map.init({
                layForm: form,
                data: {
                    cityId: '${event.cityId}',
                    areaInput: '${event.area}',
                    place: '${event.place}',
                    cityName: '${cityName}',
                    lat: '${event.lat}',
                    lng: '${event.lng}'
                }
            });
        });
        txz.saveStatus = false;
        ue.addListener('ready', function () {
            this.setHeight(500);
            if ($("#contentView").html() != "") {
                this.setHeight(850);
            }
            this.setContent($("#contentView").html());
            //等待ueditor加载完后加载缓存
            if (!'${event.id}') { //新增时使用
                formcache = new fCache({
                    fCacheKey: '${event.id}' + '_zcact',//暂存的key
                    cacheCallback: loadCacheData,//获取到缓存后加载的方法
                    getFormData: getFormData
                }).init();
            }
        });
        ue.addListener('blur', function () {
            $("#contentView").html(ue.getContent());
        });

        relatedUeditor.addListener('ready', function () {
            this.setContent($("#applyRelatedView").html());
            this.setHeight(500);
        });
        relatedUeditor.addListener('blur', function () {
            $("#applyRelatedView").html(ue.getContent());
        });

        standardUeditor.addListener('ready', function () {
            this.setContent($("#matchStandardView").html());
            this.setHeight(500);
        });
        standardUeditor.addListener('blur', function () {
            $("#matchStandardView").html(ue.getContent());
        });

        $('#sel_pic_img').click(function () {
            txz.openSelImg({
                min: 1,
                max: 1,
                info: '建议尺寸：800x450',
                type: '<%=TargetType.ZC_ACTIVITY.getCode()%>',
                cb: function (imgs) {
                    $('#cover-img').css('background-image', 'url(' + imgs[0].path + ')');
                    $('#pic').val(imgs[0].path);
                }
            })
        });
        $('#sel_poster_img').click(function () {
            txz.openSelImg({
                min: 1,
                max: 1,
                info: '建议尺寸：750x1334',
                type: '<%=TargetType.ZC_P_POSTER.getCode()%>',
                cb: function (imgs) {
                    $('#zc-p-cover-img').css('background-image', 'url(' + imgs[0].path + ')');
                    $('#networkImagePath').val(imgs[0].path);
                }
            })
        });
    })
    ;

    //此方法用于加载缓存数据
    function loadCacheData(cacheData) {
        //跑马灯
        if (cacheData['picList']) {
            var picList = JSON.parse(cacheData['picList']);
            if (picList && picList.length > 0) {
                $("#img_list").html('');
                for (var i = 0, item; i < picList.length; i++) {
                    item = picList[i];
                    $("#img_list").append('<div class="item" data-url="' + item.pic + '">' +
                        '<div class="img-item" style="background-image: url(' + item.pic + ')">' +
                        '<i class="layui-icon del-icon" onclick="delQImg(\'' + item.pic + '\',this, \'\')">&#x1007;</i>' +
                        '</div>' +
                        //'<input class="text-item" type="text" placeholder="图片描述" />'+
                        '</div>');
                }
            }
        }
        //加载视频数据
        if (cacheData['videoList']) {
            var video = JSON.parse(cacheData['videoList']);
            $('.video-link').val(video.pic);
            $('.video-remarks').val(video.remarks);
        }
        //加载封面图
        if (cacheData['pic']) {
            $('#cover-img').css('background-image', 'url(' + cacheData['pic'] + ')');
        }
        form.render();
        txz.Map.init({
            layForm: form,
            data: {
                cityId: cacheData.cityId,
                areaInput: cacheData.areaSelect || cacheData.areaInput,
                place: cacheData.place,
                lat: cacheData.lat,
                lng: cacheData.lng
            }
        });

        // 票据
        if (cacheData['costCache']) {
            var costCache = JSON.parse(cacheData['costCache']);
            if (costCache.length > 0) {
                loadCounterfoil(costCache);

                if (costCache.length == 3) {
                    $("#add_counterfoil_btn").prop('disabled', true);
                }
            }
        }
    }

    function getFormData() {
        $("#content").val(ue.getContent().replace(/&quot;/gi, ""));
        $("#applyRelated").val(relatedUeditor.getContent().replace(/&quot;/gi, ""));
        $("#matchStandard").val(standardUeditor.getContent().replace(/&quot;/gi, ""));
        // 跑马灯
        var array = new Array();
        $("#img_list .item").each(function (index, element) {
            var pic = {
                pic: $(element).attr("data-url"),
                remarks: $(element).find(".text-item").val() || ''
            }
            array.push(pic);
        });
        $("#picList").val(JSON.stringify(array));
        // 视频
        var video = {
            pic: $(".video-link").val(),
            remarks: $(".video-remarks").val()
        }
        $("#videoList").val(JSON.stringify(video));

        // 票据
        var _costArray = new Array();
        $(".cost_container").find(".cost-item-new").each(function (index, ele) {
            var map = {
                number: index + 1,
                index: index,
                name: $(ele).find(".cost_name").val() || '',
                payment: $(ele).find(".cost_payment").val() || '',
                limitNum: $(ele).find(".cost_limitNum").val() || '',
                remarks: $(ele).find(".cost_remarks").val() || ''
            };
            _costArray.push(map);
        });
        $("[name=costCache]").val(JSON.stringify(_costArray));

        return util.serializeForm($('#myForm').serializeArray());
    }

    //表单提交
    function formSubmit(data) {
        txz.submitObject(data.elem, function (callBack) {
            resetIndex();
            var formData = getFormData();
            var action = $("#myForm").attr("action");
            txz.ajaxRequest({
                method: 'post',
                url: action,
                saveCache: true,
                cacheObj: formcache,
                params: formData,
                callBack: function (res) {
                    typeof callBack === 'function' && callBack();
                    if (res.success) {
                        if ($(data.elem).hasClass('preview-btn')) {
                            if ('${empty event.id}' === 'true') {
                                location.href = '${ctx}/crowdfund/event/view.do?id=' + res.data;
                            } else {
                                var $previewFrame = $($('.preview-box').find('iframe')[0].contentWindow.document).find('iframe');
                                $previewFrame.attr('src', $previewFrame.attr('src'));
                            }
                        } else {
                            util.layerMsgSuccess("提交成功", function () {
                                location.href = "${ctx}/crowdfund/event/list.do";
                            });
                        }
                    } else {
                        util.layerMsgError("提交失败")
                    }
                }
            });
        });
        return false;
    }

    // 文本编辑器图片上传
    function uEditorUploadCI(editor) {
        txz.openSelImg({
            min: 1,
            type: '<%=TargetType.ZC_ACTIVITY.getCode()%>',
            cb: function (imgs) {
                if (imgs.length) {
                    for (var i = 0, item; i < imgs.length; i++) {
                        item = imgs[i];
                        editor.focus();
                        editor.execCommand('inserthtml', item.htmlStr);
                    }
                }
            }
        })
    }

    function uEditorUploadCIVideo(editor) {
        txz.openSelVideo({
            min: 1,
            type: '<%=TargetType.ZC_ACTIVITY.getCode()%>',
            cb: function (imgs) {
                if (imgs.length) {
                    for (var i = 0, item; i < imgs.length; i++) {
                        item = imgs[i];
                        editor.focus();
                        editor.execCommand('inserthtml', item.htmlStr);
                    }
                }
            }
        })
    }

    function openUploadCI() {
        var picLength = $(".ci-img-list .item").length;
        var maxLength = maxNum - picLength <= 0 ? 0 : maxNum - picLength;
        txz.openSelImg({
            min: 1,
            max: maxLength,
            type: '<%=TargetType.ZC_ACTIVITY.getCode()%>',
            cb: function (imgs) {
                if (imgs.length) {
                    for (var i = 0, item; i < imgs.length; i++) {
                        item = imgs[i];
                        $("#img_list").append('<div class="item" data-url="' + item.path + '">' +
                            '<div class="img-item" style="background-image: url(' + item.path + ')">' +
                            '<i class="layui-icon del-icon" onclick="delQImg(\'' + item.path + '\',this, \'\')">&#x1007;</i>' +
                            '</div>' +
                            //'<input class="text-item" type="text" placeholder="图片描述" />'+
                            '</div>');
                    }
                }
            }
        })
    }

    function delQImg(picUrl, obj, resourceId) {
        $(obj).closest(".item").remove();
    }

    function openUploadVideo() {
        txz.openSelVideo({
            min: 1,
            max: 1,
            backVideoOrIframe: 'video',
            type: '<%=TargetType.ZC_ACTIVITY.getCode()%>',
            cb: function (imgs) {
                if (imgs.length) {
                    for (var i = 0, item; i < imgs.length; i++) {
                        item = imgs[i];
                        $("#vide_code").val(item.htmlStr);
                    }
                }
            }
        })
    }

    function clearValue() {
        $("#vide_code").val("");
    }

    function openHiddenShow(title, container) {
        var index = layer.open({
            type: 1,
            area: ['800px', '700px'],
            title: [title, 'text-align:center;'],
            shade: 0.6,
            shadeClose: true,
            content: $(container)
        });
    }

    function openSelMemberDialog(that, title, url, width, height) {
        txz.openDialogIframe({
            width: width,
            height: height,
            title: title,
            url: url,
            cb: function (opt) {
                var content = opt.content;
                if (content.doSubmit()) {
                    var data = content.returnData();
                    $('#memberId').val(data.id);
                    $('#memberName').val(data.name);
                    expireTime = data.expirationTime;
                    top.layer.close(opt.index);

                    if (expireTime) {
                        var expirationDate = new Date(expireTime);
                        if (expirationDate.getTime() > new Date().getTime()) {
                            isExpire = false;
                        } else {
                            isExpire = true;
                        }
                        endLaydate.config.max = {
                            year: expirationDate.getFullYear(),
                            month: expirationDate.getMonth(),
                            date: expirationDate.getDate(),
                            hours: expirationDate.getHours(),
                            minutes: expirationDate.getMinutes(),
                            seconds: expirationDate.getSeconds()
                        };
                    }
                }
            }
        })
    }
    function doloadPoster() {
        var networkImagePath = $("#networkImagePath").val();
        var memberId = $('#memberId').val()
        var loadIndex = top.layer.load(1, {
            shade: [0.1, '#fff'] //0.1透明度的白色背景
        });
        txz.ajaxRequest({
            url: '${ctx}/crowdfund/project/newYearPosterDemo.do?networkImagePath=' + networkImagePath+'&memberId='+memberId,
            type: 'get',
            async: false, // 使用同步的方法
            callBack: function (data) {
                top.layer.close(loadIndex);

                if (data.success) {
                    var posterUrl = data.description;
                    if (posterUrl.trim() == "") {
                        util.layerAlertError("海报生成失败,请稍等一会")
                    } else {
                        util.layerAlertSuccess("海报生成成功", function () {
                            //console.log("posterUrl——————————"+posterUrl);

                            window.open(posterUrl);
                        })
                    }
                } else {
                    util.layerAlertError("海报生成失败,请稍等一会")
                }
            }
        });
    }

    //加载背景乐列表
    function loadAudioSelect(audioId_val) {

        var array = new Array();
        $.ajax({
            url: '${ctx}/audio/getAudioListAll.do',
            type: 'POST',
            dataType: 'json',
            data: {},
            async: false, // 使用同步的方法
            success: function (res) {

                if (res.success) {
                    var data = res.data;
                    for (var i = 0; i < data.length; i++) {
                        if (audioId_val == data[i].id) {
                            array.push("<option value = '" + data[i].id + "' title='" + data[i].audioUrl + "'  selected='selected'  >" +
                                "" + data[i].audioTitle + "</option>");
                            isShowAudiolabel(data[i].audioUrl);
                        } else {
                            array.push("<option value = '" + data[i].id + "' title='" + data[i].audioUrl + "' >" + data[i].audioTitle + "</option>");
                        }
                    }
                }
            }
        });
        $("#audioId").append(array.join(""));
        form.render('select');
    }

    function isShowAudiolabel(audioUrl_val) {
        if (audioUrl_val != "") {
            $("#audioUrlId").show();
            $("#audioUrlId").children("audio").attr("src", audioUrl_val);
        } else {
            $("#audioUrlId").children("audio").attr("src", "");
            $("#audioUrlId").hide();
        }
    }
</script>
</body>
</html>